<?php
	
	$mail_id = isset($_REQUEST['mail']) ? (int)$_REQUEST['mail'] : '';
	if($mail_id == '') {
		exit("<h1>Письмо не найдено</h1>");
	} else {
		$mbox = imap_open("{imap.yandex.ru:993/ssl}INBOX", "bomberweb", "ggOnZo13q") or die("can't connect: " . imap_last_error());
		$body = imap_fetchbody($mbox, $mail_id, "1");
		$header_info = imap_fetchheader($mbox, $mail_id);
		print("<hr>");
		print("Письмо");
		print("<hr>");
		print($body);
		//print('Исходная кодировка', 'UTF-8', iconv(base64_decode($body)));
		print("<hr>");
		print("<pre>");
		print_r($header_info);
		print("</pre>");
	}

?>